package operation.impl;

import book.Book;
import book.BookList;
import operation.IOperation;

/**
 * 借书
 */
public class BorrowOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("当前进行的是借书书籍操作~");
        System.out.print("请输入书籍名称：");
        String bookName= scanner.next();
        if(bookList.contains(bookName)){
            Book book = bookList.currentBook(bookName);
            if(book.isBorrowed()==false){
                book.setBorrowed(true);
                System.out.println("借书成功！");
            }else {
                System.out.println("该书已被借出！");
            }
        }else {
            System.out.println("无该书籍~");
            return;
        }
    }
}
